home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 June
/
MACPOWER-1997-06.ISO.7z
/
MACPOWER-1997-06.ISO
/
AMUG
/
PROGRAMMING
/
BSDSoundLib 1.0.1.sit
/
BSDSoundLib dist
/
BSDSoundLib ƒ
/
BSDSoundLib.doc
< prev
next >
Wrap
Text File
|
1997-01-21
|
3KB
|
93 lines
BSDSoundLib v1.0.1
BuggySoftェ Development
By Scott Dunbar.
ゥ 1997.
general email : BuggySoft@post1.com
tech support : sdunbar@post1.com
web : http://www.aimnet.com/~buggysft/
ftp : ftp://ftp.aimnet.com/pub/users/buggysft/
BSDSoundLib is a CodeWarrior 10(still waiting for 11 in the mail :) library that I made for
my own use in a game of ours called Torture Chamber. You can use this lib free of charge, but
please send me an email or something (it's only fair).
With this, you can easily have async sound play-back on multiple channels (RAM permitting)
and do some cool stereo panning as well as have background music. In my opinion, this is the
easiest set of sound routines to use ever.
Call this routines like this:
// to play one sound normally
{
// get your sound to play
Handle sndHandle = GetResource('snd ', 128);
// Initialize the sound channels and stuff
InitSoundUtils();
// grab a free channel
short chanNum = FindFreeChannel();
// check to see if a channel was found (-1 is returned if not)
// then play the sound on that channel
if (chanNum != -1) PlaySound(chanNum, sndHandle);
// wait until the sound is done (or do anything that you want)
while (sndChanActive[chanNum]);
// Silence the channel if needed
SilenceChannel(chanNum);
// Dispose of everything (except your aquired sound handles when you're done
DisposeSoundUtils();
}
// to change the volume of a channel
{
/*
setup a channel and start it playing first
*/
SetChanVol(chanNum, kMaxLeft); // sets the left volume full and the right to 0
SetChanVol(chanNum, kMaxRight); // sets the right volume full and the left to 0
SetChanVol(chanNum, kBalanced); // balances the volume on a given channel
BalanceSndChannels(); // balances volume on all channels
/*
you can use any number from -128 to 128 for the volume.
*/
}
// to play a sound and keep it looping (for cool background music or something)
{
// get your sound to play
Handle sndHandle = GetResource('snd ', 128);
// Initialize the looping sound channel
InitLoopingSounds();
// Start the sound on its jolly little looping way
PlayLoopingSound(sndHandle);
// Silence the channel if needed
SilenceLoopingChannel();
// Dispose of the sound channel (except your aquired sound handles) when you're done
DisposeLoopingSounds();
}
Check out the header, "BSDSoundLib.h," for more info on them.
I've got some more stuff planned, but I'm too tired to add them now. Check back with me later
if you want the latest version.
For working examples of the library in use, check in the 'examples' folder
contained in this archive.
Drop by our web page for updates at:
"http://www.aimnet.com/~buggysft/"
Thanks!
- Scott Dunbar